//
//  myNotification.swift
//  serverMonitor
//
//  Created by joke on 16/1/8.
//  Copyright © 2016年 joke. All rights reserved.
//

import UIKit

class MyObserver: NSObject {
    var name:String = ""
    
    init(name:String) {
        super.init()
        self.name = name
        let operationQueue = NSOperationQueue.mainQueue()
        NSNotificationCenter.defaultCenter().addObserverForName(UIApplicationWillEnterForegroundNotification, object: nil, queue: operationQueue) { (notification:NSNotification!) -> Void in
            print("进入前台")
        }
    }
    
    deinit {
        NSNotificationCenter.defaultCenter().removeObserver(self)
    }
}
